# -*- coding: utf-8 -*-
import datetime
from typing import Optional

from pydantic import BaseModel, EmailStr, Field


class CreateProjectTimer(BaseModel):
    """_创建用户工时计时的项目,不一定是专案_

    Args:
        BaseModel (_type_): _description_
    """

    loginid: str = Field(..., example="用户的loginid不需要用户手动填写")
    # user_id:Mapped[int] = mapped_column(ForeignKey('user_table.id'),nullable=False,comment='所属用户的id')
    name: str = Field(..., example="项目的名称")
    type: str = Field(..., example="项目类别")
    plan_time: int = Field(..., example=100)
    introduction: Optional[str] = Field(..., example="项目的额外说明(可以没有)")


class StartProjectTimer(BaseModel):
    """_开始工时计时_

    Args:
        BaseModel (_type_): _description_
    """

    project_id: int = Field(..., example="项目的id")


class CreateProjectTimerDao(BaseModel):
    """_创建用户工时计时的项目,Dao层_

    Args:
        BaseModel (_type_): _description_
    """

    user_id: int
    name: str
    type: str
    plan_time: int
    introduction: Optional[str]


class ProjectWithUserInfo(BaseModel):
    """返回的项目信息

    Args:
        BaseModel (_type_): 返回的信息除了项目的基本信息,还要有一些用户的信息
    """

    id: str = None
    user_id: int = None
    name: str = None
    type: str = None
    progress: float = None
    acc_time: int = None
    plan_time: int = None
    introduction: Optional[str] = None
    create_time: datetime.datetime = None
    update_time: Optional[datetime.datetime] = None

    loginid: Optional[str] = None
    user_name: Optional[str] = None
